// 自定义外链
var app = getApp()
Page({
  data: {
    
  },
  onLoad: function (e) {
    var that = this;
    that.requestUrl();
  },
  onShow:function(){
    app.setCartnum();//更新购物车数量
  },
  requestUrl:function(){
    var that = this;
    wx.showLoading({
      title: '加载中',
    })
    wx.request({
      url: app.globalData.requestUrl,
      data: {
        map: 'applet_promotional_video'
      },
      success: function (res) {
        console.log(res.data);
        if (res.data.ec == 200) {
          var data = res.data.data;
          that.setData({
            linksrc: data.vrurl,
            title: data.vrShareTitle ? data.vrShareTitle:'',
            cover: data.vrShareCover ? data.vrShareCover:''
          })
        } else {
          that.setData({
            linksrc: ''
          })
        }
      },
      complete: function () {
        wx.hideLoading();
        wx.stopPullDownRefresh();
      }
    })
  },
  onPullDownRefresh:function(){
    var that = this;
    that.requestUrl();
  },
  onShareAppMessage: function () {
    var that = this;
    var linksrc = that.data.linksrc;
    var title = that.data.title ? that.data.title:'';
    var cover = that.data.cover ? that.data.cover:'';
    app.getPoint(that);
    return {
      title: title,
      imageUrl: cover,
      path: '/pages/commonViewTab/commonViewTab'
    }
  }
})